# Maintainer: Thore Bödecker <foxxx0@archlinux.org>
# Contributor: Tim Meusel <tim@bastelfreak.de>

_gemname='net-ping'
pkgname="ruby-${_gemname}"
pkgver=2.0.8
pkgrel=2
pkgdesc='Provides a ping interface for Ruby. It includes separate TCP, HTTP, LDAP, ICMP, UDP and external ping classes.'
arch=('any')
url='https://github.com/chernesk/net-ping'
license=('Artistic-2.0')
depends=('ruby')
makedepends=('ruby-rake' 'ruby-rdoc' 'ruby-rake-compiler' 'ruby-yard' 'ruby-rspec' 'ruby-bundler')
checkdepends=('ruby-test-unit' 'ruby-fakeweb')
options=('!emptydirs')
source=("${url}/archive/${_gemname}-${pkgver}.tar.gz")
sha512sums=('f4c3c84e82345a4be9218ae9f71796a992bf66ee21562778c51d6b10bda93489008bd56b4f6d2c3b623cd3f9af0c5d47e57fd5e96994604ead825477783558b0')

prepare() {
  cd "${srcdir}/${_gemname}-${_gemname}-${pkgver}"
  :
}

build() {
  cd "${srcdir}/${_gemname}-${_gemname}-${pkgver}"
  rake gem:create
}

check() {
  cd "${srcdir}/${_gemname}-${_gemname}-${pkgver}"
  # pretty much all tests require elevated capabilities (i.e NET:RAW), skip them
  #rake test
}

package() {
  cd "${srcdir}/${_gemname}-${_gemname}-${pkgver}"
  local _gemdir="$(gem env gemdir)"
  gem install \
    --ignore-dependencies \
    --no-user-install \
    -i "${pkgdir}/${_gemdir}" \
    -n "${pkgdir}/usr/bin"  \
    "${_gemname}-${pkgver}.gem"

  cd "${pkgdir}/${_gemdir}"
  rm -rf cache
}

# vim: ts=2 sw=2 et:
